package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IUseStatisticsDAO;
import org.jsbd.boss.domian.statistics.UseStatisticsDto;
import org.springframework.stereotype.Repository;

@Repository("useStatisticsDAO")
public class UseStatisticsDAOImpl extends CrackStatisticsBaseDao implements IUseStatisticsDAO {

	@Override
	public Map<String, Object> findBaseListWithPage(DataGridModel page, UseStatisticsDto usDTO) {
		usDTO = (usDTO == null ? new UseStatisticsDto() : usDTO);
		usDTO.setPageInfo(page);
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("rows", super.queryForList("qy_use_statistics.SELECT_BASE_LIST_WITH_PAGE", usDTO));
		result.put("total", super.queryForList("qy_use_statistics.SELECT_BASE_COUNT_WITH_PAGE", usDTO));
		return result;
	}

	@Override
	public Map<String, Object> findPrivinceListWithPage(DataGridModel page, UseStatisticsDto usDTO) {
		usDTO = (usDTO == null ? new UseStatisticsDto() : usDTO);
		usDTO.setPageInfo(page);
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("rows", super.queryForList("qy_use_statistics.SELECT_PROVINCE_LIST_WITH_PAGE", usDTO));
		result.put("total", super.queryForList("qy_use_statistics.SELECT_PROVINCE_COUNT_WITH_PAGE", usDTO));
		return result;
	}

	@Override
	public List<UseStatisticsDto> selectRecords(UseStatisticsDto usDTO) {
		return super.queryForList("qy_use_statistics.SELECT_RECORDS", usDTO);
	}

	@Override
	public List<Integer> selectTotalNum(List<String> xAxis) {
		return super.queryForList("qy_use_statistics.SELECT_TOTAL_NUM", xAxis.toArray());
	}

	@Override
	public List<UseStatisticsDto> selectPartRecords(UseStatisticsDto usDTO) {
		return super.queryForList("qy_use_statistics.SELECT_PART_RECORDS", usDTO);
	}

}
